package cn.wit.summit.chwan.models.dbmanager.upgrade;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import cn.wit.summit.chwan.models.greendao.gen.DaoMaster;
import cn.wit.summit.chwan.models.greendao.gen.DownLoadTaskTableDao;

/**
 * Created by Alan on 2018/6/7.
 */

public class MyDevOpenHelper extends DaoMaster.DevOpenHelper {

    public MyDevOpenHelper(Context context, String name) {
        super(context, name);
    }

    public MyDevOpenHelper(Context context, String name,
                              SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

    //重新实现数据库更新操作
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        //数据版本变更才会执行， 下面方法可以传多个表对应的Dao文件，用逗号分隔
        MigrationHelper.migrate(db, DownLoadTaskTableDao.class);
    }
}
